function formSub(){
	var user_name=document.getElementById('user_name').value;
	var passwd=document.getElementById('passwd').value;
	if(user_name==''){
			alert('请输入用户名！');
			document.getElementById('user_name').focus();
			return false;
		}
		if(passwd==''){
			alert('请输入密码！');
			document.getElementById('passwd').focus();
			return false;
		}
		 
		if(!checkname(user_name,passwd)){
			alert("您的用户名或密码错误");
			return false;
		} 
		document.loginForm.submit();
		
}
function checkname(user_name,password){

	var bool = true;
	jQuery.ajax({
		type: "POST",
		cache:false,
        async:false,
		url: "/templets/html/jsp/checkUserLogin.jsp",
		data:"user_name=" + user_name+"&password="+password,
		success: function(data){
			 if(data!=null && data!=""){
				if( data == 0 ){
					bool = false;
				} 
			 }
		}
	});
	return bool;
}

 document.onkeydown = keyDown;
		
	function keyDown(e){ 
		if((e ? e.which : event.keyCode)==13 ){
				formSub();
		}
	}

	function GetFocus(){
		document.getElementById('user_name').focus();
	}